import { http } from "@/utils/http";
const baseUrl = "http://localhost";
// const baseUrl = "http://www.toubutu.com";
export type WeiXinQrCodeResult = {
  flag: boolean;
  code: number;
  message: string;
  data: {
    codeUrl: string;
    codeId: string;
  };
};

export type ScanResult = {
  flag: boolean;
  code: number;
  message: string;
  data: {
    isExpire: boolean;
    isScan: boolean;
    accessToken: string;
    refreshToken: string;
  };
};
//获取微信登录二维码
export const getWeiXinQrCode = (data?: Object) => {
  return http.request<WeiXinQrCodeResult>(
    "get",
    `${baseUrl}/auth/officialCode`,
    { data }
  );
};

//获取微信二维码扫描结果
export const getWeiXinScanResult = (params: any) => {
  return http.request<ScanResult>("post", `${baseUrl}/auth/scan/result`, {
    params
  });
};
